package cuda.translation;

import java.util.HashMap;
import java.util.Map;

public class CPU_TransRules implements ITransRules {

	protected Map<OpType, String> map = new HashMap<OpType, String>();
	
	public CPU_TransRules() {
		
		map.put(OpType.INIT, "_cpu_init");
		map.put(OpType.SHUTDOWN, "_cpu_shutdown");
		
		map.put(OpType.VECTOR_COPY,"_cpu_vector_copy"); 
		map.put(OpType.VECTOR_LITERAL,"_cpu_vector_literal"); 
		map.put(OpType.VECTOR_EQUAL_VECTOR,"_cpu_vector_equal");
		map.put(OpType.VECTOR_NEQUAL_VECTOR,"_cpu_vector_nequal");
		map.put(OpType.VECTOR_PLUS_VECTOR,"_cpu_vector_plus_vector");
		map.put(OpType.VECTOR_MINUS_VECTOR,"_cpu_vector_minus_vector");
		
		map.put(OpType.MATRIX_TIMES_VECTOR,"_cpu_matrix_times_vector");
		map.put(OpType.VECTOR_TIMES_MATRIX,"_cpu_vector_times_matrix");
		
		map.put(OpType.MATRIX_COPY,"_cpu_matrix_copy");
		map.put(OpType.MATRIX_EQUAL_MATRIX,"_cpu_matrix_equal");
		map.put(OpType.MATRIX_NEQUAL_MATRIX,"_cpu_matrix_nequal");
		map.put(OpType.MATRIX_PLUS_MATRIX,"_cpu_matrix_plus_matrix");
		map.put(OpType.MATRIX_MINUS_MATRIX,"_cpu_matrix_minus_matrix");
		map.put(OpType.MATRIX_TIMES_MATRIX,"_cpu_matrix_times_matrix");
		// na razie olewam dzielenie macierzy przez macierz, too troublesome
		
		map.put(OpType.SCALAR_TIMES_VECTOR,"_cpu_scalar_times_vector");
		map.put(OpType.SCALAR_TIMES_MATRIX,"_cpu_scalar_times_matrix");
		map.put(OpType.VECTOR_DIV_SCALAR,"_cpu_vector_div_scalar");
		map.put(OpType.MATRIX_DIV_SCALAR,"_cpu_matrix_div_scalar");
	}

	@Override
	public String getFunctionName(OpType opType) {
		return map.get(opType);
	}

	@Override
	public String getHeaderFileName() {
		return "CPU_Backend.h";
	}
	
	@Override
	public String getSourceFileName() {
		return "CPU_Backend.cpp";
	}

	@Override
	public String getLibraryName() {
		return "cpu.lib";
	}
	
}
